

package com.maoshi.shop.api.listener;

import com.maoshi.shop.api.config.ApiConfig;
import com.maoshi.shop.bean.event.PayVipEvent;
import lombok.AllArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 购买vip时的事件
 * @author LGH
 */
@Component("payVipListener")
@AllArgsConstructor
public class PayVipListener {

    private final ApiConfig apiConfig;
    /**
     * 获取支付时的域名
     */
    @EventListener(PayVipEvent.class)
    public void defaultShopCartEvent(PayVipEvent event) {
        List<String> domainNames = event.getDomainNames();
        domainNames.add(apiConfig.getDomainName());
    }

}
